home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
051-075
/
scopedisk69
/
jlib20a
/
cbug
< prev
next >
Wrap
Text File
|
1995-03-19
|
3KB
|
102 lines
'this file demonstrates the stack overflow bug in the AC/BASIC compiler
' and a work-around solution to it.
'the problem occurs when there are more than 249 total arguments in CALLs
' to machine language routines in any program module
'the solution (until the bug is fixed, anyway) is to place the ml CALLs in
' SUB programs and then call the SUB programs. There is no overflow problem
' in calling SUB programs
'this file contains two programs - make two copies and delete everything above
' the `CUT' line in one, and everything below it in the other. the top half
' demonstates the bug and the bottom half demonstrates how you can avoid it.
' both halves will run in AmigaBASIC, but only the bottom half will compile.
WINDOW 1,,(417,11)-(617,59),31,-1
DEFINT a-z
rts=&h4e75
'AbSoft docs state that the CALL rts&(1,2...) format must be used in ml calls,
' but this works! (other than the bug, of course)
rts&=VARPTR(rts)
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
rts& 1,2,3,4,5,6,7,8,9,0
PRINT "CLICK MOUSE!"
WHILE MOUSE(0)<>0:WEND:WHILE MOUSE(0)=0:SLEEP:WEND
'==================== CUT HERE! ========== CUT HERE! ====================
WINDOW 1,,(417,11)-(617,59),31,-1
DEFINT a-z
rts=&h4e75
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
test 1,2,3,4,5,6,7,8,9,0
PRINT "CLICK MOUSE!"
WHILE MOUSE(0)<>0:WEND:WHILE MOUSE(0)=0:SLEEP:WEND
SUB test(a,b,c,d,e,f,g,h,i,j) STATIC
SHARED rts
rts&=VARPTR(rts)
rts& a,b,c,d,e,f,g,h,i,j
'AbSoft docs state that the CALL rts&(1,2...) format must be used in ml calls,
' but this works! (other than the bug, of course)
END SUB